package com.wz.project.rkrgv.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.rkrgv.domain.MsgRgvRk;
import com.wz.project.rkrgv.service.IMsgRgvRkService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 入库RGV监控Controller
 * 
 * @author wz
 * @date 2024-01-10
 */
@Controller
@RequestMapping("/rkrgv/rkrgv")
public class MsgRgvRkController extends BaseController
{
    private String prefix = "rkrgv/rkrgv";

    @Autowired
    private IMsgRgvRkService msgRgvRkService;

    @RequiresPermissions("rkrgv:rkrgv:view")
    @GetMapping()
    public String rkrgv()
    {
        return prefix + "/rkrgv";
    }

    /**
     * 查询入库RGV监控列表
     */
//    @RequiresPermissions("rkrgv:rkrgv:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MsgRgvRk msgRgvRk)
    {
        startPage();
        List<MsgRgvRk> list = msgRgvRkService.selectMsgRgvRkList(msgRgvRk);
        return getDataTable(list);
    }

    /**
     * 导出入库RGV监控列表
     */
    @RequiresPermissions("rkrgv:rkrgv:export")
    @Log(title = "入库RGV监控", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MsgRgvRk msgRgvRk)
    {
        List<MsgRgvRk> list = msgRgvRkService.selectMsgRgvRkList(msgRgvRk);
        ExcelUtil<MsgRgvRk> util = new ExcelUtil<MsgRgvRk>(MsgRgvRk.class);
        return util.exportExcel(list, "rkrgv");
    }

    /**
     * 新增入库RGV监控
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存入库RGV监控
     */
    @RequiresPermissions("rkrgv:rkrgv:add")
    @Log(title = "入库RGV监控", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(MsgRgvRk msgRgvRk)
    {
        return toAjax(msgRgvRkService.insertMsgRgvRk(msgRgvRk));
    }

    /**
     * 修改入库RGV监控
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        MsgRgvRk msgRgvRk = msgRgvRkService.selectMsgRgvRkById(id);
        mmap.put("msgRgvRk", msgRgvRk);
        return prefix + "/edit";
    }

    /**
     * 修改保存入库RGV监控
     */
    @RequiresPermissions("rkrgv:rkrgv:edit")
    @Log(title = "入库RGV监控", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(MsgRgvRk msgRgvRk)
    {
        return toAjax(msgRgvRkService.updateMsgRgvRk(msgRgvRk));
    }

    /**
     * 删除入库RGV监控
     */
    @RequiresPermissions("rkrgv:rkrgv:remove")
    @Log(title = "入库RGV监控", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(msgRgvRkService.deleteMsgRgvRkByIds(ids));
    }
}
